package com.lyEducation.core.system;

import com.aliyuncs.exceptions.ClientException;
import com.lyEducation.controllers.dto.system.InsertSysUserDto;
import com.lyEducation.core.base.BaseCodeService;
import com.lyEducation.entities.system.SysRoleEntity;
import com.lyEducation.entities.system.SysUserEntity;
import com.lyEducation.util.controllerUtil.JsonResult;

import javax.servlet.http.HttpServletRequest;
import java.io.FileNotFoundException;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/** @author eiven */
public interface SysUserService extends BaseCodeService<SysUserEntity> {

  //  /**
  //   * 根据用户代码找用户信息
  //   *
  //   * @author eiven
  //   * @param code 用户代码
  //   * @return Map<String,Object>
  //   */
  //  SysUserEntity getUserMapByCode(String code);

  /**
   * 用户信息保存或新增
   *
   * @author eiven
   * @param paramsMap
   * @return
   */
  JsonResult doSaveOrUpdate(Map paramsMap);


  /**
   * 注销登录
   *
   * @param request
   * @return boolean
   */
  boolean layout(HttpServletRequest request);
  //  /**
  //   * 登录
  //   *
  //   * @param paramsMap 查询条件
  //   * @return JsonResult
  //   */
  //  JsonResult doLogin(Map paramsMap);

  /**
   * 分配用户角色
   *
   * @param paramsMap 查询条件
   * @return JsonResult
   */
  JsonResult addUserRole(Map paramsMap);


  /** 用户角色列表 */
  List<SysRoleEntity> userRoleList(String uId);

  /** 更新登录成功基本参数 */
  void updUserParamByLoginSuccess(HttpServletRequest httpServletRequest)
      throws UnknownHostException;

  //  /** 更新登出基本参数 */
  //  void updUserParamByLoginOut(HttpServletRequest httpServletRequest) throws
  // UnknownHostException;

  /**
   * @param primaryKey
   * @param activeType 0邮箱链接激活 1手机验证码激活
   * @return
   */
  JsonResult activeUser(String primaryKey, int activeType);

  JsonResult saveOrUpdate(InsertSysUserDto insertSysUserDto) throws FileNotFoundException, ClientException, ExecutionException, InterruptedException;

  SysUserEntity findUserCheckRole(String id);
}
